package com.itliang.utils.mqtt;

import com.itliang.core.model.entity.equipment.Equipment;

import java.util.List;

/**
 * @author : liangzhuoyuan
 */
public class MqttMessageUtils {

    public static String hardwareStatus(List<Equipment> list) {
        StringBuffer json = new StringBuffer("{");
        for (Equipment equipment : list) {
            StringBuffer partJson =
                    new StringBuffer("\"" + equipment.getCode() + "\":" + equipment.getStatus() + ",");
            json.append(partJson);
        }
        json.replace(json.length() - 1, json.length(), "}");
        return json.toString();
    }

}
